﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Text;
using TT.Logic.Entities;

namespace TT.Logic
{
    
    public partial class DbContext : System.Data.Entity.DbContext, Interfaces.ITTContext
    {
        public DbContext() : base("DbContext") { }

        static DbContext()
        {
            Database.SetInitializer<DbContext>(new TTContextInitializer());
        }

        public IDbSet<Match> Matches { get; set; }
        public IDbSet<Player> Players { get; set; }
        public IDbSet<TT.Logic.Entities.Tournament> Tournaments { get; set; }
        public IDbSet<Round> Rounds { get; set; }

        protected override void OnModelCreating(
            System.Data.Entity.DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
        }
    }
}
